/**
 * Writed by yura and mak
 */

package wz.legend.gui;

/**
 * 
 * @author yura
 */
public class ProductDetailsPanel extends javax.swing.JFrame {

    private javax.swing.JPanel closePanel;
    private javax.swing.JScrollPane dataTable;
    private javax.swing.JTable jTable1;
    private javax.swing.JPanel tablePanel;
    private javax.swing.JButton closeButton;

    public ProductDetailsPanel( ) {
        initComponents();
    }

    private void initComponents() {
        tablePanel = new javax.swing.JPanel();
        dataTable = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        closePanel = new javax.swing.JPanel();
        closeButton = new javax.swing.JButton();

        setBounds(new java.awt.Rectangle(200, 200, 0, 0));
        setLocationByPlatform(true);
        setMinimumSize(new java.awt.Dimension(500, 300));

        tablePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tablePanel.setName("tablePanel"); // NOI18N
        tablePanel.setLayout(new java.awt.BorderLayout());

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][] { { null, null, null }, { null, null, null },
                        { null, null, null }, { null, null, null } },
                new String[] { "Product", "date", "price" }) {
            boolean[] canEdit = new boolean[] { false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        jTable1.getTableHeader().setReorderingAllowed(false);
        dataTable.setViewportView(jTable1);
        jTable1.getColumnModel().getColumn(0).setMinWidth(200);
        jTable1.getColumnModel().getColumn(1).setMinWidth(50);
        jTable1.getColumnModel().getColumn(1).setPreferredWidth(100);
        jTable1.getColumnModel().getColumn(1).setMaxWidth(100);
        jTable1.getColumnModel().getColumn(2).setMinWidth(50);
        jTable1.getColumnModel().getColumn(2).setPreferredWidth(100);
        jTable1.getColumnModel().getColumn(2).setMaxWidth(150);

        tablePanel.add(dataTable, java.awt.BorderLayout.CENTER);

        closePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        closeButton.setText("Close");
        closeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout choosePanelLayout = new javax.swing.GroupLayout(
                closePanel);
        closePanel.setLayout(choosePanelLayout);
        choosePanelLayout.setHorizontalGroup(choosePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(
                        javax.swing.GroupLayout.Alignment.TRAILING,
                        choosePanelLayout.createSequentialGroup()
                                .addContainerGap(496, Short.MAX_VALUE)
                                .addComponent(closeButton).addContainerGap()));
        choosePanelLayout.setVerticalGroup(choosePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(
                        choosePanelLayout.createSequentialGroup()
                                .addContainerGap().addComponent(closeButton)
                                .addContainerGap(12, Short.MAX_VALUE)));

        tablePanel.add(closePanel, java.awt.BorderLayout.PAGE_END);

        getContentPane().add(tablePanel, java.awt.BorderLayout.CENTER);
    }

    private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {
        setVisible(false);
        dispose();
    }

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ProductDetailsPanel().setVisible(true);
            }
        });
    }

}
